package io.shallwe._admin.line;

import com.jfinal.aop.Inject;
import com.jfinal.kit.Ret;
import com.jfinal.plugin.activerecord.Record;
import io.shallwe._admin.permission.Remark;
import io.shallwe.common.controller.BaseController;
import io.shallwe.history.ParameterCurveService;

/**
 * @Description: 周转车信息历史页面
 * @author: gkw
 * @description: io.shallwe._admin.line
 * @date:2019/11/11
 **/
public class TurnoverVehicleHistoryController extends BaseController {

    @Inject
    TurnoverVehicleService service;
    @Inject
    ParameterCurveService parameterCurveService;

    @Remark("周转车历史信息")
    public void index() {
        checkUrlPara(0);
        render("index_history.html");
    }

    @Remark("周转车历史信息数据列表")
    public void list() {
        Integer offset = getParaToInt("offset", 1);
        Integer pageSize = getParaToInt("pageSize", 100);
        String traceCode=get("traceCode");
        String rackNo=get("rackNo");
        String vehicleNo=get("vehicleNo");

        renderJson(service.historyPaginate(offset, pageSize, traceCode, rackNo, vehicleNo));
    }

    @Remark("历史追溯单追溯完工单打印页面")
    public void print() {
        String id = get("id");
//		TurnoverVehicle vehicle = service.findById(id);
        Record vehicle=service.findPrintPageInfo(id);
        set("vehicle", vehicle);
        render("print_history.html");
    }

    @Remark("执行历史追溯完工单打印操作")
    public void doPrint() {
        String id = get("id");
        renderJson(Ret.ok("msg","操作成功"));
    }

    @Remark("物件产线详细信息页")
    public void locationDetailPage(){
        String barcode = get("barcode");
        set("barcode",barcode);
        render("location_history_detail.html");
    }

    @Remark("物件产线详细列表")
    public void locationDetailList(){
        String barcode = get("barcode");
        renderJson(parameterCurveService.findLocationDetailByBarcode(barcode));
    }
}
